import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np

# 示例数据
data = np.array([[23, 14, 0, 0, 0, 0, 0],
                 [0, 66, 9, 0, 0, 0, 0],
                 [0, 0, 91, 0, 0, 0, 0],
                 [0, 0, 0, 130, 0, 0, 0],
                 [0, 0, 0, 0, 126, 0, 0],
                 [0, 0, 0, 0, 0, 42, 0],
                 [0, 0, 0, 10, 0, 0, 72]])

# 创建热力图
fig, ax = plt.subplots()
sns.heatmap(data, annot=True, fmt="d", cmap="YlGnBu", ax=ax)  # 使用 "YlGnBu" 颜色映射

# 设置背景颜色
fig.patch.set_facecolor('white')  # 设置背景颜色为白色

# 设置标签和标题
ax.set_xlabel('Predicted Label')
ax.set_ylabel('Actual Label')
ax.set_title('Confusion Matrix')

plt.show()